package com.lineage.data.item_etcitem.shop;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.S_ServerMessage;
import com.lineage.server.serverpackets.ServerBasePacket;
import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ResetPassword extends ItemExecutor {
  private static final Log _log = LogFactory.getLog(ResetPassword.class);
  
  public static final Random _random = new Random();
  
  public static ItemExecutor get() {
    return new ResetPassword();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    try {
      if (item == null)
        return; 
      if (pc == null)
        return; 
      if (pc.is_retitle()) {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage("\\fU你不是要变更封号吗?"));
        return;
      } 
      pc.repass(1);
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "y_pass_01", new String[] { "请输入您的旧密码" }));
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
}
